package com.example.meijun.pantest;

import java.io.File;
import java.sql.SQLTransactionRollbackException;
import java.util.Map;

/**
 * Created by meijun on 17-4-6.
 *
 *
 * 封装下载的bean;
 */

public class DownloadItem {


    public  String url;
    public File destination;
    public Map<String,String> params ;
    public ProgressResponseBody.ProgressListener progressListener;

    /***
     *
     * @param url   下载的地址
     * @param destination 下载文件的保存位置
     * @param params    参数
     * @param progressListener  下载文件的进度监听,可以为空;
     */
    @Deprecated
    public DownloadItem(String url, File destination, Map<String,String> params, ProgressResponseBody.ProgressListener progressListener) {
        this.url = url;
        this.destination = destination;
        this.params = params;
        this.progressListener = progressListener;
    }

    /***
     *
     * @param url   下载的地址
     * @param destination 下载文件的保存位置
     * @param params 联网参数
     *
     */
    public DownloadItem(Map<String, String> params, String url, File destination) {
        this.params = params;
        this.url = url;
        this.destination = destination;
    }

    public Map<String, String> getParams() {
        return params;
    }

    public void setParams(Map<String, String> params) {
        this.params = params;
    }

    public String getUrl() {
        return url;
    }



    public void setUrl(String url) {
        this.url = url;
    }

    public File getDestination() {
        return destination;
    }

    public void setDestination(File destination) {
        this.destination = destination;
    }



    public ProgressResponseBody.ProgressListener getProgressListener() {
        return progressListener;
    }

    @Deprecated
    public void setProgressListener(ProgressResponseBody.ProgressListener progressListener) {
        this.progressListener = progressListener;
    }


    @Override
    public String toString() {
        return "DownloadItem{" +
                "url='" + url + '\'' +
                ", destination=" + destination +
                ", params=" + params +
                '}';
    }
}
